<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

<script>

    console.log("=========== 题目7 ===========");
    console.log(window);
    console.log('zc' in window);
    console.log('hai' in window);
    console.log('test' in window);
    // zc = 'asdf'
    console.log(zc);
    if (true) {
        var zc = 'zc';
        var hai = 'hai';
        // test()
        console.log("1111111");
        function test() {
            console.log("test");
        }
    }
    console.log(zc);
    test();


    // ================ 题目8 ================
    // console.log(eight);
    // var eight = 1;
    // function eight() {
    //     console.log(1);
    // }

    // 或

    console.log(eight);
    function eight() {
        console.log(1);
    }
    var eight = 1;

    // ================ 题目8 ================
    console.log("================ 题目8 ================");
    var a = 10;
    (function () {
        console.log(a) // undefined
        a = 5
        console.log(window.a) // 10
        var a = 20;
        console.log(a) // 20
    })()

    var b = {
        a,
        c: b
    }
    console.log(b.c); // undefined

    // ================ 题目9 ================
    console.log("================ 题目9 ================");
    var a = 1;
    function foo(a, b) {
        console.log(a); // 1
        a = 2;
        arguments[0] = 3;
        var a;
        // console.log(this === window);
        console.log(a, this.a, b); // 3, 1, undefined
    }
    foo(a);



</script>

</html>